import apis from '../../api/apis.js';
export default {
	namespaced: true,
	state: {
		store: [],
		storehome: {},
		goods:[]
	},
	mutations: {
		//获取店铺信息
		changestore(state, data) {
			state.store = data.serviceInfoList;
			state.storehome = data.shop
			// console.log(state.store,123456789)
		},
		goodslist(state, data){
			state.goods = data.serviceList;
		}
	},
	actions: {
		//传id获取店铺首次渲染信息和切换栏信息
		async getBeautyNavigation(context, id) {
			const data = await apis.carBeauty.getBeautyNavigation(id);
			// context.commit('changestore',data)
			return data;
			// console.log(data);
		},
		async getBeautyGoodList(context, id) {
			const {
				data
			} = await apis.carBeauty.getBeautyGoodList(id);
			return data;
			// console.log(data,1231)
		},
		//获取店铺信息
		async getStoreHome(context, id) {
			// console.log(id,123)
			const data = await apis.carBeauty.getStoreHome(id);
			console.log(data, 12344)
			context.commit('changestore', data)
		},
		//评论
		async getEvaluation(context, id) {
			const data = await apis.carBeauty.getEvaluation(id);
			return data;
			// console.log(data[0])
		},
		//添加订单
		async postAddOrder(context, val) {
			const data = await apis.carBeauty.postAddOrder(val);
			console.log(data)
			// return data;
		},
		//购买
		async postBuy(context, val) {
			const data = await apis.carBeauty.postBuy(val);
			// console.log(data,1231231231)
			return data;
		},
		//支付
		async postPay(context, val) {
			const data = await apis.carBeauty.posPay(val);
			return data;
		},
		//保养商城
		async getGoodList(context) {
			const data = await apis.carBeauty.getGoodList();
			console.log(data.serviceList,1111111111)
			context.commit('goodslist', data)
		}
	}
}
